import logging
import redis


class Config(object):
    DEBUG = True
    SECRET_KEY = "@%$#%#^$&$^#^%&^%$&^"
    # 1.2 mysql数据库链接地址,# 设置不跟踪数据库的修改
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/info_gz09"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 2.2创建redis链接对象
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # 配置session信息
    SESSION_TYPE = "redis"
    SESSION_KEY_PREFIX = "Session:"
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = 3600*24*2


class DevelopmentConfig(Config):
    DEBUG = True
    LOG_LV = logging.DEBUG

class ProductionConfig(Config):
    DEBUG = False
    LOG_LV = logging.ERROR

config_dict ={
    "develop":DevelopmentConfig,
    "product":ProductionConfig
}

